﻿<?xml version="1.0" encoding="utf-8" ?>
<AdoNetDataAccess connection="$UserManagementDBConnection$" formatter="bizobjlist of UserGroup(appPrivileges)">
	<FormatterInfo>
		<code for="postEach" on="appPrivileges"><![CDATA[
			if(CurrentBizObj != null)
				CurrentBizObj.put("depth", 2);
		]]></code>
	</FormatterInfo>

	<Sql>
		SELECT g.id, g.name, g.description, g.dateCreated, g.dateUpdated, g.lastUpdateBy, g.createdBy, g.autoNotify, g.systemType,
		g.companyId, p.id AS appPrivilegesid, p.privilegeLevel as appPrivilegesprivilege
		FROM   UserGroup AS g LEFT JOIN PrivilegeLevel AS p ON g.id = p.userGroupId
		WHERE g.companyId = @companyId
		ORDER BY g.id
	</Sql>
	<Param name="companyId" type="UniqueIdentifier"/>
</AdoNetDataAccess>